Release 10.1A: OpenEdge Development:
Progress 4GL Reference


SESSION system handle

A handle to the current OpenEdge session object. This object allows you to read and modify the current OpenEdge session context.

Syntax

SESSION [ :attribute | :method ] 

attribute

Specifies an attribute of the SESSION system handle.

method

Specifies a method of the SESSION system handle.

Attributes

 

Methods

 

Example

The following example uses the SESSION:IMMEDIATE-DISPLAY attribute. When dumping or loading records from the database, the procedure displays a running count of records. If IMMEDIATE-DISPLAY is false, no value is shown until all records are dumped or loaded. At that point, the total is shown. To prevent this, IMMEDIATE-DISPLAY is set to true just before the dump or load and then reset to false afterwards.

r-dstrig.p
DEFINE SUB-MENU file
  MENU-ITEM viewit LABEL "&View Data"
  MENU-ITEM dumpit LABEL "&Dump Data"
  MENU-ITEM loadit LABEL "&Load Data".
  MENU-ITEM exit   LABEL "E&xit".
  DEFINE MENU mbar MENUBAR
  SUB-MENU file LABEL "&File".
  DEFINE BUTTON b_more LABEL "Next".
DEFINE BUTTON b_exit LABEL "Cancel".
DEFINE FRAME cust-frame
  customer.cust-num SKIP
  customer.name  SKIP
  customer.phone SKIP
  b_more b_exit
  WITH CENTERED SIDE-LABELS ROW 3.
DEFINE STREAM cust.
DEFINE VARIABLE i AS INTEGER NO-UNDO.

PAUSE 0 BEFORE-HIDE.

ON CHOOSE OF b_exit IN FRAME cust-frame
DO:
  HIDE FRAME cust-frame NO-PAUSE.
  DISABLE ALL WITH FRAME cust-frame.
  LEAVE.
END.  

ON CHOOSE OF b_more IN FRAME cust-frame
DO:
  FIND NEXT customer NO-LOCK NO-ERROR.
  IF NOT AVAILABLE(customer) THEN
    RETURN.
  DISPLAY customer.cust-num customer.name customer.phone
    WITH FRAME cust-frame.
END. 
ON CHOOSE OF MENU-ITEM viewit
DO:
  ENABLE ALL WITH FRAME cust-frame.
  FIND FIRST customer NO-LOCK NO-ERROR.
  DISP customer.cust-num customer.name customer.phone 
    WITH FRAME cust-frame.
  APPLY "ENTRY" TO b_more.
END.

ON CHOOSE OF MENU-ITEM dumpit
DO:
  DISABLE TRIGGERS FOR DUMP OF customer.
  i = 1.
  SESSION:IMMEDIATE-DISPLAY = TRUE.
  OUTPUT STREAM cust TO "customer.d".
  FOR EACH customer NO-LOCK:
    EXPORT STREAM cust customer.
    DISP i LABEL "Records Processed" 
      WITH FRAME rec-info SIDE-LABELS ROW SCREEN-LINES / 2 CENTERED.
    i = i + 1.
  END.
  SESSION:IMMEDIATE-DISPLAY = FALSE.
  OUTPUT STREAM cust CLOSE.
END.

ON CHOOSE OF MENU-ITEM loadit
DO:
  DISABLE TRIGGERS FOR LOAD OF customer.
  INPUT FROM "customer.d".
  SESSION:IMMEDIATE-DISPLAY = TRUE.
  REPEAT:
    CREATE customer.
    IMPORT customer.
    DISP i LABEL "Records Processed"
      WITH FRAME rec-info SIDE-LABELS ROW SCREEN-LINES / 2 CENTERED.
    i = i + 1.
  END.
  INPUT CLOSE.
  SESSION:IMMEDIATE-DISPLAY = FALSE.
END.

IF NOT RETRY THEN  
ASSIGN CURRENT-WINDOW:MENUBAR = MENU mbar:HANDLE
       CURRENT-WINDOW:VISIBLE = TRUE.
 
WAIT-FOR CHOOSE OF MENU-ITEM exit. 

Notes


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095